package com.alon.spring01.study;

import cn.hutool.core.date.DateUtil;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import sun.misc.Unsafe;

/**
 * @program: spring01
 * @description: hashMap测试
 * @author: yulongguang
 * @create: 2019-05-04 21:48
 **/
public class HashNameTest {

    private volatile int value;

    public static void main(String[] args) {

    }

    public final int get() {
        return value;
    }

    public final int incrementAndGet() {
        for (; ; ) {
            int current = get();
            int next = current - 1;
            if (compareAndGet(current,next)) {

            }
        }
    }

    public final boolean compareAndGet(int expect,int update) {
//        return Unsafe.compareAndSwapInt(this,1,expect,update);
        return true;
    }
}
